<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/page.css"/>
		<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/ajaxpingrun.js"></script>
		<title><?php echo $artInfo['title'];?></title>
		<meta name="keywords" content="<?php echo $artInfo['keywords'];?>">
		<meta name="description" content="<?php echo $artInfo['description'];?>">
		<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/style.css" />
<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.css"/>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/jq17.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/js.js"></script>
<script type="text/javascript">
	var checkUser = "<?php echo U('User/ajaxCheckUser');?>";
	var checkNick = "<?php echo U('User/ajaxCheckNickName');?>";
	var checkCode = "<?php echo U('User/ajaxCheckCode');?>";
	var checkLogin = "http://127.0.0.1/cms/cms/index.php/Index/user/ajaxLoginReturn";
$(function(){
	$('#loginclose').click(function(){
		$(this).parents('.login_hide_box').hide();
	});
	$('#regclose').click(function(){
		$(this).parents('.reg_hide_box').hide();
	});
})
	
</script>
<script src="http://127.0.0.1/cms/cms/Static/js/ajaxlogin.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/validate.js"></script>

</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href="http://127.0.0.1/cms/cms"><img src="http://127.0.0.1/cms/cms/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<?php
	$navList = M('category')->field('cid,cname,ctitle,htmldir,is_archtml')->where('pid=0')->limit(10)->all();
	foreach($navList as $navs):
	$navs['url'] = getCateUrl($navs['is_archtml'],$navs['htmldir'],$navs['cid']);
?>
	
				<li>
					<a href="<?php echo $navs['url'];?>"><?php echo $navs['cname'];?></a>
				</li>
				
<?php
	endforeach;
?>
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			
			<div id="loginInfo" class='loginInfo'>
				<div id="islogin" style="display:none;"><span><?php echo $hd['session']['username'];?></span><a href="http://127.0.0.1/cms/cms/index.php/Index/user/loginout">退出</a></div>
			     <?php if(isset($hd['session']['uid'])){ ?>
				<div id="islogin"><span><?php echo $hd['session']['username'];?></span><a href="http://127.0.0.1/cms/cms/index.php/Index/user/loginout">退出</a></div>
			 <?php } ?>
			 <div id="isout" style="display:block;">
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
				<a href="javascript:showRegBox();">注册</a>
				</div>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="http://127.0.0.1/cms/cms/index.php/Index/user/login" method="post">
			<div class="login_hide_box">
				
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<span id="hd_username"></span> <a href="javascript:;" id="loginclose">关闭</a></p>
					<input type="text" name="username" class="text" />
					<p>密码：<span id="hd_password"></span></p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="http://127.0.0.1/cms/cms/index.php/Index/user/register" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<a href="javascript:;" id="regclose">关闭</a></p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="http://127.0.0.1/cms/cms/index.php/Index/user/code" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			<p><span class="title">最新消息：
			<?php
		$result = M('article')->field('htmldir,cname,is_archtml,aid,sendtime,click,title,thumb,digest,author,category_cid')->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where('is_recycle=0')->order('sendtime DESC')->limit(1)->all();
		foreach($result as $v):
			//组合图片图片
			$v['thumb']  = 'http://127.0.0.1/cms/cms/'.$v['thumb'];
			$v['commnum'] = K('Comment')->findCountComment($v['aid']);
			$category = K('Category')->findCate($v['category_cid']);
			$v['category_name'] = $category['cname'];
			//生成连接地址
			$v['url'] = getStaticPath($v['is_archtml'],$v['htmldir'],$v['aid']);
			
			 
?>	
	<a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
<?php
	endforeach;
?>	
			</span>
					
			</p>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
	<!-- 主体区域 -->
		<!-- 顶部最新消息区域结束 -->
		<!-- 主体区域 -->
		<div id="page_main">
			<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!-- 右侧区域 -->
		<div class="right">
			<div class='hd_title'>
				<strong>标签云</strong>	
			</div>
			<div id="tagBox" class='tags'>
				<?php
		$result = K('Tag')->findAllTagLimit(20);
		foreach($result as $tag):
			$tid = $tag['tid']; 
			$midd = M('article_tag')->where("tag_tid=$tid")->all();
			if(!$midd){
				continue;
			}
?>
	
				<a href="http://127.0.0.1/cms/cms/index.php/Index/list/index/tid/<?php echo $tag['tid'];?>"><?php echo $tag['tagname'];?></a>
				
<?php
	endforeach;	
?>
			</div>
			<div class='hd_title'>
				<strong>热门文章</strong>	
			</div>
			<ul class='arc_list'>
					<?php
		$result = K('article')->findSpeExp('is_recycle=0','click DESC',8);
		foreach($result as $hotart):
		$hotart['thumb']  = 'http://127.0.0.1/cms/cms/'.$hotart['thumb'];
		$hotart['commnum'] = K('Comment')->findCountComment($hotart['aid']);
		//生成连接地址
		$hotart['url'] = getStaticPath($hotart['is_archtml'],$hotart['htmldir'],$hotart['aid']);
?>
		
					<li>
						<div class='image'>
							<a href="<?php echo $hotart['url'];?>">
								<img src="<?php echo $hotart['thumb'];?>" alt="<?php echo hd_substr($hotart['title'],23,'...');?>" />
							</a>
						</div>
						<h2><a href="<?php echo $hotart['url'];?>"><?php echo hd_substr($hotart['title'],23,'...');?></a></h2>
						<p>
							<em><?php echo date('m-d',$hotart['sendtime']);?></em><span><?php echo $hotart['commnum'];?>条评论</span>
						</p>
					</li>
					
<?php
	endforeach;
?>
			</ul>
			<div class='hd_title'>
				<strong>推荐文章</strong>	
			</div>
			
			<ul class='arc_list'>
					<?php
		$result = K('article')->findSpeExp('is_recycle=0 AND attr LIKE "%推荐%"','click DESC',8);
		foreach($result as $recom):
		$recom['thumb']  = 'http://127.0.0.1/cms/cms/'.$recom['thumb'];
		$recom['commnum'] = K('Comment')->findCountComment($recom['aid']);
		//生成连接地址
		$recom['url'] = getStaticPath($recom['is_archtml'],$recom['htmldir'],$recom['aid']);
?>
		
					<li>
						<div class='image'>
							<a href="<?php echo $recom['url'];?>">
								<img src="<?php echo $recom['thumb'];?>" alt="<?php echo hd_substr($recom['title'],25,'...');?>"/>
							</a>
						</div>
						<h2><a href="<?php echo $recom['url'];?>"><?php echo hd_substr($recom['title'],25,'...');?></a></h2>
						<p>
							<em><?php echo date('m-d',$recom['sendtime']);?></em><span><?php echo $recom['commnum'];?>条评论</span>
						</p>
					</li>
					
<?php
	endforeach;
?>		
			</ul>
		</div>
		<!-- 右侧区域结束 -->
			<!-- 左侧 -->
			<div class="left">
				<h1><a href=""><?php echo $artInfo['title'];?></a></h1>
				<!-- 文章信息 -->
				<div class="article_info_box">
					<p class="article_info">
						<span class="padding_right">发表时间:<?php echo date('m-d H:i:s',$artInfo['sendtime']);?></span> 分类：
						<a href="http://127.0.0.1/cms/cms/index.php/Index/list/cid/<?php echo $artInfo['category']['cid'];?>" class="padding_right"><?php echo $artInfo['category']['cname'];?></a>
						<a href="" class="padding_right comment"><?php echo $artInfo['commentcount'];?>条评论</a>
						<span id="click"><?php echo $artInfo['click'];?></span>次浏览
					</p>
				</div>
				<!-- 文章信息结束 -->

				<!-- 文章内容区域 -->
				<div class="article_content">
					<?php echo $artInfo['content'];?>
				</div>
				<!-- 文章内容区域结束 -->

				<p class="position">当前位置：<a href="http://127.0.0.1/cms/cms/index.php/Index/list/cid/<?php echo $artInfo['category']['cid'];?>"><?php echo $artInfo['category']['cname'];?></a> » <a href=""><?php echo $artInfo['title'];?></a>
				</p>
				<p class="tags">
					继续浏览有关
					<!-- //标签 -->
					<?php foreach ($artInfo['tags'] as $key=>$val){?>
						<a href=""><?php echo $val['tagname'];?></a>
					<?php }?>
					的文章</p>
				<!-- 相关文章 -->
				<ul id="msg_list" class="msg_list">
					<p id="loading">
						<img src="http://127.0.0.1/cms/cms/Template/default/images/loading.gif" style='width:50px;height:50px;'>
					</p>
					<div>
						评论：
						<ul class="comment-ul">
							<?php foreach ($comment as $key=>$v){?>
							<li style="padding:10px;">
								<strong style="margin:0 10px;font-size:18px;"><?php echo $v['username'];?>: </strong>
								<span style="font-size:18px;"><?php echo $v['comcon'];?></span> 
								<span style="font-size:13px;color:#999;float:right"><?php echo date("Y-m-d",$v['addtime']);?></span>
							</li>
							<?php }?>
						</ul>
					</div>
				</ul>
				<div id="comment-form-box" style="display:none;">
						<form id="commentForm" action="<?php echo U('comment');?>" method="post">
							<input type="hidden" name="article_aid" value="<?php echo $hd['get']['aid'];?>" />
							<textarea id="comment_content" name="comcon"></textarea>
							<input class='submit' type="submit" value="发表评论">
						</form>
					</div>
				    <?php if($hd['session']['username']){ ?>
					<div id="comment-form-box">
						<form id="commentForm" action="<?php echo U('comment');?>" method="post">
							<input type="hidden" name="article_aid" value="<?php echo $hd['get']['aid'];?>" />
							<textarea id="comment_content" name="comcon"></textarea>
							<input class='submit' type="submit" value="发表评论">
						</form>
					</div>
				<?php } ?>
				<!-- 主体区域结束 -->
				<!-- 底部浅灰色导航区域 -->
				<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
	<!-- 底部浅灰色导航区域 -->
	<div id="bottom_menu_box" style="margin-top:30px;">
		<div class="bottom_menu">
			<?php
		$result = K('flink')->showAllFlink(1,10,'sort DESC');
		foreach($result as $flink):
		$flink['url'] = 'http://'.$flink['url'];
		$flink['logo']  = 'http://127.0.0.1/cms/cms/'.$flink['logo'];
		
?>
	
			<dl>
				    <?php if($flink['logo']){ ?>
					<dt><a href="<?php echo $flink['url'];?>" style="margin-top:10px;"><img src="<?php echo $flink['logo'];?>" alt="<?php echo $flink['fname'];?>" /></a></dt>
					<?php }else{ ?>
					<dt><a href="<?php echo $flink['url'];?>"><?php echo $flink['fname'];?></a></dt>
				<?php } ?>
			</dl>
			
<?php
	endforeach;
?>	
		</div>
	</div>
	<!-- 底部浅灰色导航区域结束 -->

	<!-- 底部版权区域 -->
	<div id="bottom_copyright_box">
		<div class="bottom_copyright">
			版权信息:Copyright 2015 <?php echo $copy;?>
		</div>
	</div>
	<!-- 底部版权区域结束 -->
	
</body>
</html>